package com.shiguiwu.springmybatis.javabase.generics;

import java.lang.reflect.Type;
import java.lang.reflect.TypeVariable;

/**
 * @description: 泛型
 * @author: stone
 * @date: Created by 2021/3/12 11:28
 * @version: 1.0.0
 * @pakeage: com.shiguiwu.springmybatis.generics
 */
public class GenericsClass<E,T1,T2 extends Integer,T3 extends GenericsTwo & GenericsOne> {

    public static void main(String[] args) {
        TypeVariable<Class<GenericsClass>>[] typeVariables = GenericsClass.class.getTypeParameters();
        for (TypeVariable<Class<GenericsClass>> typeVariable : typeVariables) {
            System.out.println("变量名称：" + typeVariable.getName());
            System.out.println("这个变量在哪里声明的：" + typeVariable.getGenericDeclaration());

            System.err.println("==========================================");
            Type[] bounds = typeVariable.getBounds();
            System.out.println("这个变量上边界数量：" + bounds.length);
            System.out.println("这个变量上边界清单：");
            for (Type bound : bounds) {
                System.out.println(bound.getTypeName());

            }
            System.out.println("============================================");
        }
    }
}
